home *** CD-ROM | disk | FTP | other *** search
/ Mac-Source 1994 July / Mac-Source_July_1994.iso / Other Langs / python / emacs-info / python-lib.info-3 < prev    next >
Encoding:
GNU Info File  |  1994-04-01  |  45.6 KB  |  1,081 lines  |  [TEXT/R*ch]

  1. This is Info file python-lib.info, produced by Makeinfo-1.55 from the
  2. input file lib.texi.
  3.  
  4. This file describes the built-in types, exceptions and functions and the
  5. standard modules that come with the Python system.  It assumes basic
  6. knowledge about the Python language.  For an informal introduction to
  7. the language, see the Python Tutorial.  The Python Reference Manual
  8. gives a more formal definition of the language.  (These manuals are not
  9. yet available in INFO or Texinfo format.)
  10.  
  11. Copyright (C) 1991, 1992, 1993, 1994 by Stichting Mathematisch Centrum,
  12. Amsterdam, The Netherlands.
  13.  
  14. All Rights Reserved
  15.  
  16. Permission to use, copy, modify, and distribute this software and its
  17. documentation for any purpose and without fee is hereby granted,
  18. provided that the above copyright notice appear in all copies and that
  19. both that copyright notice and this permission notice appear in
  20. supporting documentation, and that the names of Stichting Mathematisch
  21. Centrum or CWI not be used in advertising or publicity pertaining to
  22. distribution of the software without specific, written prior permission.
  23.  
  24. STICHTING MATHEMATISCH CENTRUM DISCLAIMS ALL WARRANTIES WITH REGARD TO
  25. THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
  26. FITNESS, IN NO EVENT SHALL STICHTING MATHEMATISCH CENTRUM BE LIABLE FOR
  27. ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
  28. WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
  29. ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
  30. OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  31.  
  32. 
  33. File: python-lib.info,  Node: posixpath,  Next: pwd,  Prev: posix,  Up: UNIX ONLY
  34.  
  35. Standard Module `posixpath'
  36. ===========================
  37.  
  38. This module implements some useful functions on POSIX pathnames.
  39.  
  40.  - function of module posixpath: basename (P)
  41.      Return the base name of pathname P.  This is the second half of
  42.      the pair returned by `posixpath.split(P)'.
  43.  
  44.  - function of module posixpath: commonprefix (LIST)
  45.      Return the longest string that is a prefix of all strings in LIST.
  46.      If LIST is empty, return the empty string (`''').
  47.  
  48.  - function of module posixpath: exists (P)
  49.      Return true if P refers to an existing path.
  50.  
  51.  - function of module posixpath: expanduser (P)
  52.      Return the argument with an initial component of `~' or `~USER'
  53.      replaced by that USER's home directory.  An initial `~' is
  54.      replaced by the environment variable `$HOME'; an initial `~USER'
  55.      is looked up in the password directory through the built-in module
  56.      `pwd'.  If the expansion fails, or if the path does not begin with
  57.      a tilde, the path is returned unchanged.
  58.  
  59.  - function of module posixpath: isabs (P)
  60.      Return true if P is an absolute pathname (begins with a slash).
  61.  
  62.  - function of module posixpath: isfile (P)
  63.      Return true if P is an existing regular file.  This follows
  64.      symbolic links, so both islink() and isfile() can be true for the
  65.      same path.
  66.  
  67.  - function of module posixpath: isdir (P)
  68.      Return true if P is an existing directory.  This follows symbolic
  69.      links, so both islink() and isdir() can be true for the same path.
  70.  
  71.  - function of module posixpath: islink (P)
  72.      Return true if P refers to a directory entry that is a symbolic
  73.      link.  Always false if symbolic links are not supported.
  74.  
  75.  - function of module posixpath: ismount (P)
  76.      Return true if P is a mount point.  (This currently checks whether
  77.      `P/..' is on a different device from P or whether `P/..' and P
  78.      point to the same i-node on the same device -- is this test
  79.      correct for all UNIX and POSIX variants?)
  80.  
  81.  - function of module posixpath: join (P, Q)
  82.      Join the paths P and Q intelligently: If Q is an absolute path,
  83.      the return value is Q.  Otherwise, the concatenation of P and Q is
  84.      returned, with a slash (`'/'') inserted unless P is empty or ends
  85.      in a slash.
  86.  
  87.  - function of module posixpath: normcase (P)
  88.      Normalize the case of a pathname.  This returns the path unchanged;
  89.      however, a similar function in `macpath' converts upper case to
  90.      lower case.
  91.  
  92.  - function of module posixpath: samefile (P, Q)
  93.      Return true if both pathname arguments refer to the same file or
  94.      directory (as indicated by device number and i-node number).
  95.      Raise an exception if a stat call on either pathname fails.
  96.  
  97.  - function of module posixpath: split (P)
  98.      Split the pathname P in a pair `(HEAD, TAIL)', where TAIL is the
  99.      last pathname component and HEAD is everything leading up to that.
  100.      If P ends in a slash (except if it is the root), the trailing
  101.      slash is removed and the operation applied to the result;
  102.      otherwise, `join(HEAD, TAIL)' equals P.  The TAIL part never
  103.      contains a slash.  Some boundary cases: if P is the root, HEAD
  104.      equals P and TAIL is empty; if P is empty, both HEAD and TAIL are
  105.      empty; if P contains no slash, HEAD is empty and TAIL equals P.
  106.  
  107.  - function of module posixpath: splitext (P)
  108.      Split the pathname P in a pair `(ROOT, EXT)' such that `ROOT + EXT
  109.      == P', the last component of ROOT contains no periods, and EXT is
  110.      empty or begins with a period.
  111.  
  112.  - function of module posixpath: walk (P, VISIT, ARG)
  113.      Calls the function VISIT with arguments `(ARG, DIRNAME, NAMES)'
  114.      for each directory in the directory tree rooted at P (including P
  115.      itself, if it is a directory).  The argument DIRNAME specifies the
  116.      visited directory, the argument NAMES lists the files in the
  117.      directory (gotten from `posix.listdir(DIRNAME)').  The VISIT
  118.      function may modify NAMES to influence the set of directories
  119.      visited below DIRNAME, e.g., to avoid visiting certain parts of
  120.      the tree.  (The object referred to by NAMES must be modified in
  121.      place, using `del' or slice assignment.)
  122.  
  123. 
  124. File: python-lib.info,  Node: pwd,  Next: select,  Prev: posixpath,  Up: UNIX ONLY
  125.  
  126. Built-in Module `pwd'
  127. =====================
  128.  
  129. This module provides access to the UNIX password database.  It is
  130. available on all UNIX versions.
  131.  
  132. Password database entries are reported as 7-tuples containing the
  133. following items from the password database (see `<pwd.h>'), in order:
  134. `pw_name', `pw_passwd', `pw_uid', `pw_gid', `pw_gecos', `pw_dir',
  135. `pw_shell'.  The uid and gid items are integers, all others are strings.
  136. An exception is raised if the entry asked for cannot be found.
  137.  
  138. It defines the following items:
  139.  
  140.  - function of module pwd: getpwuid (UID)
  141.      Return the password database entry for the given numeric user ID.
  142.  
  143.  - function of module pwd: getpwnam (NAME)
  144.      Return the password database entry for the given user name.
  145.  
  146.  - function of module pwd: getpwall ()
  147.      Return a list of all available password database entries, in
  148.      arbitrary order.
  149.  
  150. 
  151. File: python-lib.info,  Node: select,  Next: socket,  Prev: pwd,  Up: UNIX ONLY
  152.  
  153. Built-in module `select'
  154. ========================
  155.  
  156. This module provides access to the function `select' available in most
  157. UNIX versions.  It defines the following:
  158.  
  159.  - exception of module select: error
  160.      The exception raised when an error occurs.  The accompanying value
  161.      is a pair containing the numeric error code from `errno' and the
  162.      corresponding string, as would be printed by the C function
  163.      `perror()'.
  164.  
  165.  - function of module select: select (IWTD, OWTD, EWTD, TIMEOUT)
  166.      This is a straightforward interface to the UNIX `select()' system
  167.      call.  The first three arguments are lists of `waitable objects':
  168.      either integers representing UNIX file descriptors or objects with
  169.      a parameterless method named `fileno()' returning such an integer.
  170.      The three lists of waitable objects are for input, output and
  171.      `exceptional conditions', respectively.  Empty lists are allowed.
  172.      The optional last argument is a time-out specified as a floating
  173.      point number in seconds.  When the TIMEOUT argument is omitted the
  174.      function blocks until at least one file descriptor is ready.  A
  175.      time-out value of zero specifies a poll and never blocks.
  176.  
  177.      The return value is a triple of lists of objects that are ready:
  178.      subsets of the first three arguments.  When the time-out is reached
  179.      without a file descriptor becoming ready, three empty lists are
  180.      returned.
  181.  
  182.      Amongst the acceptable object types in the lists are Python file
  183.      objects (e.g. `sys.stdin', or objects returned by `open()' or
  184.      `posix.popen()'), socket objects returned by `socket.socket()',
  185.      and the module `stdwin' which happens to define a function
  186.      `fileno()' for just this purpose.  You may also define a "wrapper"
  187.      class yourself, as long as it has an appropriate `fileno()' method
  188.      (that really returns a UNIX file descriptor, not just a random
  189.      integer).
  190.  
  191. 
  192. File: python-lib.info,  Node: socket,  Next: thread,  Prev: select,  Up: UNIX ONLY
  193.  
  194. Built-in Module `socket'
  195. ========================
  196.  
  197. This module provides access to the BSD *socket* interface.  It is
  198. available on UNIX systems that support this interface.
  199.  
  200. For an introduction to socket programming (in C), see the following
  201. papers: *An Introductory 4.3BSD Interprocess Communication Tutorial*,
  202. by Stuart Sechrest and *An Advanced 4.3BSD Interprocess Communication
  203. Tutorial*, by Samuel J.  Leffler et al, both in the UNIX Programmer's
  204. Manual, Supplementary Documents 1 (sections PS1:7 and PS1:8).  The UNIX
  205. manual pages for the various socket-related system calls also a
  206. valuable source of information on the details of socket semantics.
  207.  
  208. The Python interface is a straightforward transliteration of the UNIX
  209. system call and library interface for sockets to Python's
  210. object-oriented style: the `socket()' function returns a "socket
  211. object" whose methods implement the various socket system calls.
  212. Parameter types are somewhat higer-level than in the C interface: as
  213. with `read()' and `write()' operations on Python files, buffer
  214. allocation on receive operations is automatic, and buffer length is
  215. implicit on send operations.
  216.  
  217. Socket addresses are represented as a single string for the `AF_UNIX'
  218. address family and as a pair `(HOST, PORT)' for the `AF_INET' address
  219. family, where HOST is a string representing either a hostname in
  220. Internet domain notation like `'daring.cwi.nl'' or an IP address like
  221. `'100.50.200.5'', and PORT is an integral port number.  Other address
  222. families are currently not supported.  The address format required by a
  223. particular socket object is automatically selected based on the address
  224. family specified when the socket object was created.
  225.  
  226. All errors raise exceptions.  The normal exceptions for invalid
  227. argument types and out-of-memory conditions can be raised; errors
  228. related to socket or address semantics raise the error `socket.error'.
  229.  
  230. Non-blocking and asynchronous mode are not supported; see module
  231. `select' for a way to do non-blocking socket I/O.
  232.  
  233. The module `socket' exports the following constants and functions:
  234.  
  235.  - exception of module socket: error
  236.      This exception is raised for socket- or address-related errors.
  237.      The accompanying value is either a string telling what went wrong
  238.      or a pair `(ERRNO, STRING)' representing an error returned by a
  239.      system call, similar to the value accompanying `posix.error'.
  240.  
  241.  - data of module socket: AF_UNIX
  242.  
  243.  - data of module socket: AF_INET
  244.      These constants represent the address (and protocol) families,
  245.      used for the first argument to `socket()'.
  246.  
  247.  - data of module socket: SOCK_STREAM
  248.  
  249.  - data of module socket: SOCK_DGRAM
  250.      These constants represent the socket types, used for the second
  251.      argument to `socket()'.  (There are other types, but only
  252.      `SOCK_STREAM' and `SOCK_DGRAM' appear to be generally useful.)
  253.  
  254.  - function of module socket: gethostbyname (HOSTNAME)
  255.      Translate a host name to IP address format.  The IP address is
  256.      returned as a string, e.g.,  `'100.50.200.5''.  If the host name
  257.      is an IP address itself it is returned unchanged.
  258.  
  259.  - function of module socket: getservbyname (SERVICENAME, PROTOCOLNAME)
  260.      Translate an Internet service name and protocol name to a port
  261.      number for that service.  The protocol name should be `'tcp'' or
  262.      `'udp''.
  263.  
  264.  - function of module socket: socket (FAMILY, TYPE, PROTO)
  265.      Create a new socket using the given address family, socket type and
  266.      protocol number.  The address family should be `AF_INET' or
  267.      `AF_UNIX'.  The socket type should be `SOCK_STREAM', `SOCK_DGRAM'
  268.      or perhaps one of the other `SOCK_' constants.  The protocol
  269.      number is usually zero and may be omitted in that case.
  270.  
  271.  - function of module socket: fromfd (FD, FAMILY, TYPE, PROTO)
  272.      Build a socket object from an existing file descriptor (an integer
  273.      as returned by a file object's `fileno' method).  Address family,
  274.      socket type and protocol number are as for the `socket' function
  275.      above.  The file descriptor should refer to a socket, but this is
  276.      not checked -- subsequent operations on the object may fail if the
  277.      file descriptor is invalid.  This function is rarely needed, but
  278.      can be used to get or set socket options on a socket passed to a
  279.      program as standard input or output (e.g. a server started by the
  280.      UNIX inet daemon).
  281.  
  282. * Menu:
  283.  
  284. * Socket Object::
  285. * Socket Example::
  286.  
  287. 
  288. File: python-lib.info,  Node: Socket Object,  Next: Socket Example,  Prev: socket,  Up: socket
  289.  
  290. Socket Object Methods
  291. ---------------------
  292.  
  293. Socket objects have the following methods.  Except for `makefile()'
  294. these correspond to UNIX system calls applicable to sockets.
  295.  
  296.  - Method on socket: accept ()
  297.      Accept a connection.  The socket must be bound to an address and
  298.      listening for connections.  The return value is a pair `(CONN,
  299.      ADDRESS)' where CONN is a *new* socket object usable to send and
  300.      receive data on the connection, and ADDRESS is the address bound
  301.      to the socket on the other end of the connection.
  302.  
  303.  - Method on socket: bind (ADDRESS)
  304.      Bind the socket to an address.  The socket must not already be
  305.      bound.
  306.  
  307.  - Method on socket: close ()
  308.      Close the socket.  All future operations on the socket object will
  309.      fail.  The remote end will receive no more data (after queued data
  310.      is flushed).  Sockets are automatically closed when they are
  311.      garbage-collected.
  312.  
  313.  - Method on socket: connect (ADDRESS)
  314.      Connect to a remote socket.
  315.  
  316.  - Method on socket: fileno ()
  317.      Return the socket's file descriptor (a small integer).  This is
  318.      useful with `select'.
  319.  
  320.  - Method on socket: getpeername ()
  321.      Return the remote address to which the socket is connected.  This
  322.      is useful to find out the port number of a remote IP socket, for
  323.      instance.
  324.  
  325.  - Method on socket: getsockname ()
  326.      Return the socket's own address.  This is useful to find out the
  327.      port number of an IP socket, for instance.
  328.  
  329.  - Method on socket: getsockopt (LEVEL, OPTNAME, BUFLEN)
  330.      Return the value of the given socket option (see the UNIX man page
  331.      getsockopt(2)).  The needed symbolic constants are defined in
  332.      module SOCKET.  If the optional third argument is absent, an
  333.      integer option is assumed and its integer value is returned by the
  334.      function.  If BUFLEN is present, it specifies the maximum length
  335.      of the buffer used to receive the option in, and this buffer is
  336.      returned as a string.  It's up to the caller to decode the
  337.      contents of the buffer (see the optional built-in module `struct'
  338.      for a way to decode C structures encoded as strings).
  339.  
  340.  - Method on socket: listen (BACKLOG)
  341.      Listen for connections made to the socket.  The argument (in the
  342.      range 0-5) specifies the maximum number of queued connections.
  343.  
  344.  - Method on socket: makefile (MODE)
  345.      Return a "file object" associated with the socket.  (File objects
  346.      were described earlier under Built-in Types.) The file object
  347.      references a `dup'ped version of the socket file descriptor, so
  348.      the file object and socket object may be closed or
  349.      garbage-collected independently.
  350.  
  351.  - Method on socket: recv (BUFSIZE, FLAGS)
  352.      Receive data from the socket.  The return value is a string
  353.      representing the data received.  The maximum amount of data to be
  354.      received at once is specified by BUFSIZE.  See the UNIX manual page
  355.      for the meaning of the optional argument FLAGS; it defaults to
  356.      zero.
  357.  
  358.  - Method on socket: recvfrom (BUFSIZE)
  359.      Receive data from the socket.  The return value is a pair
  360.      `(STRING, ADDRESS)' where STRING is a string representing the data
  361.      received and ADDRESS is the address of the socket sending the data.
  362.  
  363.  - Method on socket: send (STRING)
  364.      Send data to the socket.  The socket must be connected to a remote
  365.      socket.
  366.  
  367.  - Method on socket: sendto (STRING, ADDRESS)
  368.      Send data to the socket.  The socket should not be connected to a
  369.      remote socket, since the destination socket is specified by
  370.      `address'.
  371.  
  372.  - Method on socket: setsockopt (LEVEL, OPTNAME, VALUE)
  373.      Set the value of the given socket option (see the UNIX man page
  374.      setsockopt(2)).  The needed symbolic constants are defined in
  375.      module `SOCKET'.  The value can be an integer or a string
  376.      representing a buffer.  In the latter case it is up to the caller
  377.      to ensure that the string contains the proper bits (see the
  378.      optional built-in module `struct' for a way to encode C structures
  379.      as strings).
  380.  
  381.  - Method on socket: shutdown (HOW)
  382.      Shut down one or both halves of the connection.  If HOW is `0',
  383.      further receives are disallowed.  If HOW is `1', further sends are
  384.      disallowed.  If HOW is `2', further sends and receives are
  385.      disallowed.
  386.  
  387. Note that there are no methods `read()' or `write()'; use `recv()' and
  388. `send()' without FLAGS argument instead.
  389.  
  390. 
  391. File: python-lib.info,  Node: Socket Example,  Prev: Socket Object,  Up: socket
  392.  
  393. Example
  394. -------
  395.  
  396. Here are two minimal example programs using the TCP/IP protocol: a
  397. server that echoes all data that it receives back (servicing only one
  398. client), and a client using it.  Note that a server must perform the
  399. sequence `socket', `bind', `listen', `accept' (possibly repeating the
  400. `accept' to service more than one client), while a client only needs
  401. the sequence `socket', `connect'.  Also note that the server does not
  402. `send'/`receive' on the socket it is listening on but on the new socket
  403. returned by `accept'.
  404.  
  405.      # Echo server program
  406.      from socket import *
  407.      HOST = ''                 # Symbolic name meaning the local host
  408.      PORT = 50007              # Arbitrary non-privileged server
  409.      s = socket(AF_INET, SOCK_STREAM)
  410.      s.bind(HOST, PORT)
  411.      s.listen(0)
  412.      conn, addr = s.accept()
  413.      print 'Connected by', addr
  414.      while 1:
  415.          data = conn.recv(1024)
  416.          if not data: break
  417.          conn.send(data)
  418.      conn.close()
  419.  
  420.      # Echo client program
  421.      from socket import *
  422.      HOST = 'daring.cwi.nl'    # The remote host
  423.      PORT = 50007              # The same port as used by the server
  424.      s = socket(AF_INET, SOCK_STREAM)
  425.      s.connect(HOST, PORT)
  426.      s.send('Hello, world')
  427.      data = s.recv(1024)
  428.      s.close()
  429.      print 'Received', `data`
  430.  
  431. 
  432. File: python-lib.info,  Node: thread,  Prev: socket,  Up: UNIX ONLY
  433.  
  434. Built-in Module `thread'
  435. ========================
  436.  
  437. This module provides low-level primitives for working with multiple
  438. threads (a.k.a. "light-weight processes" or "tasks") -- multiple
  439. threads of control sharing their global data space.  For
  440. synchronization, simple locks (a.k.a. "mutexes" or "binary semaphores")
  441. are provided.
  442.  
  443. The module is optional and supported on SGI and Sun Sparc systems only.
  444.  
  445. It defines the following constant and functions:
  446.  
  447.  - exception of module thread: error
  448.      Raised on thread-specific errors.
  449.  
  450.  - function of module thread: start_new_thread (FUNC, ARG)
  451.      Start a new thread.  The thread executes the function FUNC with
  452.      the argument list ARG (which must be a tuple).  When the function
  453.      returns, the thread silently exits.  When the function raises
  454.      terminates with an unhandled exception, a stack trace is printed
  455.      and then the thread exits (but other threads continue to run).
  456.  
  457.  - function of module thread: exit_thread ()
  458.      Exit the current thread silently.  Other threads continue to run.
  459.      *Caveat:* code in pending `finally' clauses is not executed.
  460.  
  461.  - function of module thread: exit_prog (STATUS)
  462.      Exit all threads and report the value of the integer argument
  463.      STATUS as the exit status of the entire program.  *Caveat:* code
  464.      in pending `finally' clauses, in this thread or in other threads,
  465.      is not executed.
  466.  
  467.  - function of module thread: allocate_lock ()
  468.      Return a new lock object.  Methods of locks are described below.
  469.      The lock is initially unlocked.
  470.  
  471. Lock objects have the following methods:
  472.  
  473.  - Method on lock: acquire (WAITFLAG)
  474.      Without the optional argument, this method acquires the lock
  475.      unconditionally, if necessary waiting until it is released by
  476.      another thread (only one thread at a time can acquire a lock --
  477.      that's their reason for existence), and returns `None'.  If the
  478.      integer WAITFLAG argument is present, the action depends on its
  479.      value: if it is zero, the lock is only acquired if it can be
  480.      acquired immediately without waiting, while if it is nonzero, the
  481.      lock is acquired unconditionally as before.  If an argument is
  482.      present, the return value is 1 if the lock is acquired
  483.      successfully, 0 if not.
  484.  
  485.  - Method on lock: release ()
  486.      Releases the lock.  The lock must have been acquired earlier, but
  487.      not necessarily by the same thread.
  488.  
  489.  - Method on lock: locked ()
  490.      Return the status of the lock: 1 if it has been acquired by some
  491.      thread, 0 if not.
  492.  
  493. Caveats:
  494.  
  495.    * Threads interact strangely with interrupts: the
  496.      `KeyboardInterrupt' exception will be received by an arbitrary
  497.      thread.
  498.  
  499.    * Calling `sys.exit(STATUS)' or executing `raise SystemExit, STATUS'
  500.      is almost equivalent to calling `thread.exit_prog(STATUS)', except
  501.      that the former ways of exiting the entire program do honor
  502.      `finally' clauses in the current thread (but not in other threads).
  503.  
  504.    * Not all built-in functions that may block waiting for I/O allow
  505.      other threads to run, although the most popular ones (`sleep',
  506.      `read', `select') work as expected.
  507.  
  508. 
  509. File: python-lib.info,  Node: MULTIMEDIA EXTENSIONS,  Next: CRYPTOGRAPHIC EXTENSIONS,  Prev: UNIX ONLY,  Up: Top
  510.  
  511. MULTIMEDIA EXTENSIONS
  512. *********************
  513.  
  514. The modules described in this chapter implement various algorithms that
  515. are mainly useful for multimedia applications.  They are available at
  516. the discretion of the installation.
  517.  
  518. * Menu:
  519.  
  520. * audioop::
  521. * imageop::
  522. * jpeg::
  523. * rgbimg::
  524.  
  525. 
  526. File: python-lib.info,  Node: audioop,  Next: imageop,  Prev: MULTIMEDIA EXTENSIONS,  Up: MULTIMEDIA EXTENSIONS
  527.  
  528. Built-in module `audioop'
  529. =========================
  530.  
  531. The audioop module contains some useful operations on sound fragments.
  532. It operates on sound fragments consisting of signed integer samples of
  533. 8, 16 or 32 bits wide, stored in Python strings.  This is the same
  534. format as used by the `al' and `sunaudiodev' modules.  All scalar items
  535. are integers, unless specified otherwise.
  536.  
  537. A few of the more complicated operations only take 16-bit samples,
  538. otherwise the sample size (in bytes) is always a parameter of the
  539. operation.
  540.  
  541. The module defines the following variables and functions:
  542.  
  543.  - exception of module audioop: error
  544.      This exception is raised on all errors, such as unknown number of
  545.      bytes per sample, etc.
  546.  
  547.  - function of module audioop: add (FRAGMENT1, FRAGMENT2, WIDTH)
  548.      This function returns a fragment that is the addition of the two
  549.      samples passed as parameters. WIDTH is the sample width in bytes,
  550.      either `1', `2' or `4'. Both fragments should have the same length.
  551.  
  552.  - function of module audioop: adpcm2lin (ADPCMFRAGMENT, WIDTH, STATE)
  553.      This routine decodes an Intel/DVI ADPCM coded fragment to a linear
  554.      fragment. See the description of `lin2adpcm' for details on ADPCM
  555.      coding. The routine returns a tuple `(SAMPLE, NEWSTATE)' where the
  556.      sample has the width specified in WIDTH.
  557.  
  558.  - function of module audioop: adpcm32lin (ADPCMFRAGMENT, WIDTH, STATE)
  559.      This routine decodes an alternative 3-bit ADPCM code. See
  560.      `lin2adpcm3' for details.
  561.  
  562.  - function of module audioop: avg (FRAGMENT, WIDTH)
  563.      This function returns the average over all samples in the fragment.
  564.  
  565.  - function of module audioop: avgpp (FRAGMENT, WIDTH)
  566.      This function returns the average peak-peak value over all samples
  567.      in the fragment. No filtering is done, so the useability of this
  568.      routine is questionable.
  569.  
  570.  - function of module audioop: bias (FRAGMENT, WIDTH, BIAS)
  571.      This function returns a fragment that is the original fragment
  572.      with a bias added to each sample.
  573.  
  574.  - function of module audioop: cross (FRAGMENT, WIDTH)
  575.      This function returns the number of zero crossings in the fragment
  576.      passed as an argument.
  577.  
  578.  - function of module audioop: findfactor (FRAGMENT, REFERENCE)
  579.      This routine (which only accepts 2-byte sample fragments)
  580.      calculates a factor F such that `rms(add(fragment, mul(reference,
  581.      -F)))' is minimal, i.e. it calculates the factor with which you
  582.      should multiply REFERENCE to make it match as good as possible to
  583.      FRAGMENT. The fragments should be the same size.
  584.  
  585.      The time taken by this routine is proportional to `len(fragment)'.
  586.  
  587.  - function of module audioop: findfit (FRAGMENT, REFERENCE)
  588.      This routine (which only accepts 2-byte sample fragments) tries to
  589.      match REFERENCE as good as possible to a portion of FRAGMENT
  590.      (which should be the longer fragment). It (conceptually) does this
  591.      by taking slices out of FRAGMENT, using `findfactor' to compute
  592.      the best match, and minimizing the result.  It returns a tuple
  593.      `(OFFSET, FACTOR)' with offset the (integer) offset into FRAGMENT
  594.      where the optimal match started and FACTOR the floating-point
  595.      factor as per findfactor.
  596.  
  597.  - function of module audioop: findmax (FRAGMENT, LENGTH)
  598.      This routine (which only accepts 2-byte sample fragments) searches
  599.      FRAGMENT for a slice of length LENGTH samples (not bytes!) with
  600.      maximum energy, i.e. it returns I for which
  601.      `rms(fragment[i*2:(i+length)*2])' is maximal.
  602.  
  603.      The routine takes time proportional to `len(fragment)'.
  604.  
  605.  - function of module audioop: getsample (FRAGMENT, WIDTH, INDEX)
  606.      This function returns the value of sample INDEX from the fragment.
  607.  
  608.  - function of module audioop: lin2lin (FRAGMENT, WIDTH, NEWWIDTH)
  609.      This function converts samples between 1-, 2- and 4-byte formats.
  610.  
  611.  - function of module audioop: lin2adpcm (FRAGMENT, WIDTH, STATE)
  612.      This function converts samples to 4 bit Intel/DVI ADPCM encoding.
  613.      ADPCM coding is an adaptive coding scheme, whereby each 4 bit
  614.      number is the difference between one sample and the next, divided
  615.      by a (varying) step. The Intel/DVI ADPCM algorythm has been
  616.      selected for use by the IMA, so may well become a standard.
  617.  
  618.      `State' is a tuple containing the state of the coder. The coder
  619.      returns a tuple `(ADPCMFRAG, NEWSTATE)', and the NEWSTATE should
  620.      be passed to the next call of lin2adpcm.  In the initial call
  621.      `None' can be passed as the state. ADPCMFRAG is the ADPCM coded
  622.      fragment packed 2 4-bit values per byte.
  623.  
  624.  - function of module audioop: lin2adpcm3 (FRAGMENT, WIDTH, STATE)
  625.      This is an alternative ADPCM coder that uses only 3 bits per
  626.      sample.  It is not compatible with the Intel/DVI ADPCM coder and
  627.      its output is not packed (due to laziness on the side of the
  628.      author). Its use is discouraged.
  629.  
  630.  - function of module audioop: lin2ulaw (FRAGMENT, WIDTH)
  631.      This function converts samples in the audio fragment to U-LAW
  632.      encoding and returns this as a python string. U-LAW is an audio
  633.      encoding format whereby you get a dynamic range of about 14 bits
  634.      using only 8 bit samples. It is used by the Sun audio hardware,
  635.      among others.
  636.  
  637.  - function of module audioop: minmax (FRAGMENT, WIDTH)
  638.      This function returns a tuple consisting of the minimum and maximum
  639.      values of all samples in the sound fragment.
  640.  
  641.  - function of module audioop: max (FRAGMENT, WIDTH)
  642.      This function returns the maximum of the *absolute value* of all
  643.      samples in a fragment.
  644.  
  645.  - function of module audioop: maxpp (FRAGMENT, WIDTH)
  646.      This function returns the maximum peak-peak value in the sound
  647.      fragment.
  648.  
  649.  - function of module audioop: mul (FRAGMENT, WIDTH, FACTOR)
  650.      Mul returns a fragment that has all samples in the original
  651.      framgent multiplied by the floating-point value FACTOR. Overflow is
  652.      silently ignored.
  653.  
  654.  - function of module audioop: reverse (FRAGMENT, WIDTH)
  655.      This function reverses the samples in a fragment and returns the
  656.      modified fragment.
  657.  
  658.  - function of module audioop: tomono (FRAGMENT, WIDTH, LFACTOR,
  659.           RFACTOR)
  660.      This function converts a stereo fragment to a mono fragment. The
  661.      left channel is multiplied by LFACTOR and the right channel by
  662.      RFACTOR before adding the two channels to give a mono signal.
  663.  
  664.  - function of module audioop: tostereo (FRAGMENT, WIDTH, LFACTOR,
  665.           RFACTOR)
  666.      This function generates a stereo fragment from a mono fragment.
  667.      Each pair of samples in the stereo fragment are computed from the
  668.      mono sample, whereby left channel samples are multiplied by LFACTOR
  669.      and right channel samples by RFACTOR.
  670.  
  671.  - function of module audioop: mul (FRAGMENT, WIDTH, FACTOR)
  672.      Mul returns a fragment that has all samples in the original
  673.      framgent multiplied by the floating-point value FACTOR. Overflow is
  674.      silently ignored.
  675.  
  676.  - function of module audioop: rms (FRAGMENT, WIDTH, FACTOR)
  677.      Returns the root-mean-square of the fragment, i.e.  the square
  678.      root of the quotient of the sum of all squared sample value,
  679.      divided by the sumber of samples.  This is a measure of the power
  680.      in an audio signal.
  681.  
  682.  - function of module audioop: ulaw2lin (FRAGMENT, WIDTH)
  683.      This function converts sound fragments in ULAW encoding to linearly
  684.      encoded sound fragments. ULAW encoding always uses 8 bits samples,
  685.      so WIDTH refers only to the sample width of the output fragment
  686.      here.
  687.  
  688. Note that operations such as `mul' or `max' make no distinction between
  689. mono and stereo fragments, i.e. all samples are treated equal.  If this
  690. is a problem the stereo fragment should be split into two mono
  691. fragments first and recombined later.  Here is an example of how to do
  692. that:
  693.      def mul_stereo(sample, width, lfactor, rfactor):
  694.          lsample = audioop.tomono(sample, width, 1, 0)
  695.          rsample = audioop.tomono(sample, width, 0, 1)
  696.          lsample = audioop.mul(sample, width, lfactor)
  697.          rsample = audioop.mul(sample, width, rfactor)
  698.          lsample = audioop.tostereo(lsample, width, 1, 0)
  699.          rsample = audioop.tostereo(rsample, width, 0, 1)
  700.          return audioop.add(lsample, rsample, width)
  701. If you use the ADPCM coder to build network packets and you want your
  702. protocol to be stateless (i.e. to be able to tolerate packet loss) you
  703. should not only transmit the data but also the state. Note that you
  704. should send the INITIAL state (the one you passed to lin2adpcm) along
  705. to the decoder, not the final state (as returned by the coder). If you
  706. want to use `struct' to store the state in binary you can code the
  707. first element (the predicted value) in 16 bits and the second (the
  708. delta index) in 8.
  709.  
  710. The ADPCM coders have never been tried against other ADPCM coders, only
  711. against themselves. It could well be that I misinterpreted the
  712. standards in which case they will not be interoperable with the
  713. respective standards.
  714.  
  715. The `find...' routines might look a bit funny at first sight.  They are
  716. primarily meant for doing echo cancellation. A reasonably fast way to
  717. do this is to pick the most energetic piece of the output sample,
  718. locate that in the input sample and subtract the whole output sample
  719. from the input sample:
  720.      def echocancel(outputdata, inputdata):
  721.          pos = audioop.findmax(outputdata, 800)    # one tenth second
  722.          out_test = outputdata[pos*2:]
  723.          in_test = inputdata[pos*2:]
  724.          ipos, factor = audioop.findfit(in_test, out_test)
  725.          # Optional (for better cancellation):
  726.          # factor = audioop.findfactor(in_test[ipos*2:ipos*2+len(out_test)],
  727.          #              out_test)
  728.          prefill = '\0'*(pos+ipos)*2
  729.          postfill = '\0'*(len(inputdata)-len(prefill)-len(outputdata))
  730.          outputdata = prefill + audioop.mul(outputdata,2,-factor) + postfill
  731.          return audioop.add(inputdata, outputdata, 2)
  732.  
  733. 
  734. File: python-lib.info,  Node: imageop,  Next: jpeg,  Prev: audioop,  Up: MULTIMEDIA EXTENSIONS
  735.  
  736. Built-in module `imageop'
  737. =========================
  738.  
  739. The imageop module contains some useful operations on images.  It
  740. operates on images consisting of 8 or 32 bit pixels stored in python
  741. strings. This is the same format as used by `gl.lrectwrite' and the
  742. `imgfile' module.
  743.  
  744. The module defines the following variables and functions:
  745.  
  746.  - exception of module imageop: error
  747.      This exception is raised on all errors, such as unknown number of
  748.      bits per pixel, etc.
  749.  
  750.  - function of module imageop: crop (IMAGE, PSIZE, WIDTH, HEIGHT, X0,
  751.           Y0, X1, Y1)
  752.      This function takes the image in `image', which should by `width'
  753.      by `height' in size and consist of pixels of `psize' bytes, and
  754.      returns the selected part of that image. `X0', `y0', `x1' and `y1'
  755.      are like the `lrectread' parameters, i.e. the boundary is included
  756.      in the new image.  The new boundaries need not be inside the
  757.      picture. Pixels that fall outside the old image will have their
  758.      value set to zero.  If `x0' is bigger than `x1' the new image is
  759.      mirrored. The same holds for the y coordinates.
  760.  
  761.  - function of module imageop: scale (IMAGE, PSIZE, WIDTH, HEIGHT,
  762.           NEWWIDTH, NEWHEIGHT)
  763.      This function returns a `image' scaled to size `newwidth' by
  764.      `newheight'. No interpolation is done, scaling is done by
  765.      simple-minded pixel duplication or removal. Therefore,
  766.      computer-generated images or dithered images will not look nice
  767.      after scaling.
  768.  
  769.  - function of module imageop: tovideo (IMAGE, PSIZE, WIDTH, HEIGHT)
  770.      This function runs a vertical low-pass filter over an image. It
  771.      does so by computing each destination pixel as the average of two
  772.      vertically-aligned source pixels. The main use of this routine is
  773.      to forestall excessive flicker if the image is displayed on a video
  774.      device that uses interlacing, hence the name.
  775.  
  776.  - function of module imageop: grey2mono (IMAGE, WIDTH, HEIGHT,
  777.           THRESHOLD)
  778.      This function converts a 8-bit deep greyscale image to a 1-bit deep
  779.      image by tresholding all the pixels. The resulting image is tightly
  780.      packed and is probably only useful as an argument to `mono2grey'.
  781.  
  782.  - function of module imageop: dither2mono (IMAGE, WIDTH, HEIGHT)
  783.      This function also converts an 8-bit greyscale image to a 1-bit
  784.      monochrome image but it uses a (simple-minded) dithering algorithm.
  785.  
  786.  - function of module imageop: mono2grey (IMAGE, WIDTH, HEIGHT, P0, P1)
  787.      This function converts a 1-bit monochrome image to an 8 bit
  788.      greyscale or color image. All pixels that are zero-valued on input
  789.      get value `p0' on output and all one-value input pixels get value
  790.      `p1' on output. To convert a monochrome black-and-white image to
  791.      greyscale pass the values `0' and `255' respectively.
  792.  
  793.  - function of module imageop: grey2grey4 (IMAGE, WIDTH, HEIGHT)
  794.      Convert an 8-bit greyscale image to a 4-bit greyscale image without
  795.      dithering.
  796.  
  797.  - function of module imageop: grey2grey2 (IMAGE, WIDTH, HEIGHT)
  798.      Convert an 8-bit greyscale image to a 2-bit greyscale image without
  799.      dithering.
  800.  
  801.  - function of module imageop: dither2grey2 (IMAGE, WIDTH, HEIGHT)
  802.      Convert an 8-bit greyscale image to a 2-bit greyscale image with
  803.      dithering. As for `dither2mono', the dithering algorithm is
  804.      currently very simple.
  805.  
  806.  - function of module imageop: grey42grey (IMAGE, WIDTH, HEIGHT)
  807.      Convert a 4-bit greyscale image to an 8-bit greyscale image.
  808.  
  809.  - function of module imageop: grey22grey (IMAGE, WIDTH, HEIGHT)
  810.      Convert a 2-bit greyscale image to an 8-bit greyscale image.
  811.  
  812. 
  813. File: python-lib.info,  Node: jpeg,  Next: rgbimg,  Prev: imageop,  Up: MULTIMEDIA EXTENSIONS
  814.  
  815. Built-in Module `jpeg'
  816. ======================
  817.  
  818. The module jpeg provides access to the jpeg compressor and decompressor
  819. written by the Independent JPEG Group. JPEG is a (draft?) standard for
  820. compressing pictures.  For details on jpeg or the Indepent JPEG Group
  821. software refer to the JPEG standard or the documentation provided with
  822. the software.
  823.  
  824. The jpeg module defines these functions:
  825.  
  826.  - function of module jpeg: compress (DATA, W, H, B)
  827.      Treat data as a pixmap of width w and height h, with b bytes per
  828.      pixel.  The data is in sgi gl order, so the first pixel is in the
  829.      lower-left corner. This means that lrectread return data can
  830.      immedeately be passed to compress.  Currently only 1 byte and 4
  831.      byte pixels are allowed, the former being treaded as greyscale and
  832.      the latter as RGB color.  Compress returns a string that contains
  833.      the compressed picture, in JFIF format.
  834.  
  835.  - function of module jpeg: decompress (DATA)
  836.      Data is a string containing a picture in JFIF format. It returns a
  837.      tuple `(DATA, WIDTH, HEIGHT, BYTESPERPIXEL)'.  Again, the data is
  838.      suitable to pass to lrectwrite.
  839.  
  840.  - function of module jpeg: setoption (NAME, VALUE)
  841.      Set various options.  Subsequent compress and decompress calls
  842.      will use these options.  The following options are available:
  843.     `'forcegray''
  844.           Force output to be grayscale, even if input is RGB.
  845.  
  846.     `'quality''
  847.           Set the quality of the compressed image to a value between
  848.           `0' and `100' (default is `75').  Compress only.
  849.  
  850.     `'optimize''
  851.           Perform huffman table optimization.  Takes longer, but
  852.           results in smaller compressed image.  Compress only.
  853.  
  854.     `'smooth''
  855.           Perform inter-block smoothing on uncompressed image.  Only
  856.           useful for low-quality images.  Decompress only.
  857.  
  858. Compress and uncompress raise the error jpeg.error in case of errors.
  859.  
  860. 
  861. File: python-lib.info,  Node: rgbimg,  Prev: jpeg,  Up: MULTIMEDIA EXTENSIONS
  862.  
  863. Built-in module `rgbimg'
  864. ========================
  865.  
  866. The rgbimg module allows python programs to access SGI imglib image
  867. files (also known as `.rgb' files).  The module is far from complete,
  868. but is provided anyway since the functionality that there is is enough
  869. in some cases.  Currently, colormap files are not supported.
  870.  
  871. The module defines the following variables and functions:
  872.  
  873.  - exception of module rgbimg: error
  874.      This exception is raised on all errors, such as unsupported file
  875.      type, etc.
  876.  
  877.  - function of module rgbimg: sizeofimage (FILE)
  878.      This function returns a tuple `(X, Y)' where X and Y are the size
  879.      of the image in pixels.  Only 4 byte RGBA pixels, 3 byte RGB
  880.      pixels, and 1 byte greyscale pixels are currently supported.
  881.  
  882.  - function of module rgbimg: longimagedata (FILE)
  883.      This function reads and decodes the image on the specified file,
  884.      and returns it as a python string. The string has 4 byte RGBA
  885.      pixels.  The bottom left pixel is the first in the string. This
  886.      format is suitable to pass to `gl.lrectwrite', for instance.
  887.  
  888.  - function of module rgbimg: longstoimage (DATA, X, Y, Z, FILE)
  889.      This function writes the RGBA data in DATA to image file FILE. X
  890.      and Y give the size of the image.  Z is 1 if the saved image
  891.      should be 1 byte greyscale, 3 if the saved image should be 3 byte
  892.      RGB data, or 4 if the saved images should be 4 byte RGBA data.
  893.      The input data always contains 4 bytes per pixel.  These are the
  894.      formats returned by `gl.lrectread'.
  895.  
  896.  - function of module rgbimg: ttob (FLAG)
  897.      This function sets a global flag which defines whether the scan
  898.      lines of the image are read or written from bottom to top (flag is
  899.      zero, compatible with SGI GL) or from top to bottom(flag is one,
  900.      compatible with X).  The default is zero.
  901.  
  902. 
  903. File: python-lib.info,  Node: CRYPTOGRAPHIC EXTENSIONS,  Next: STDWIN ONLY,  Prev: MULTIMEDIA EXTENSIONS,  Up: Top
  904.  
  905. CRYPTOGRAPHIC EXTENSIONS
  906. ************************
  907.  
  908. The modules described in this chapter implement various algorithms of a
  909. cryptographic nature.  They are available at the discretion of the
  910. installation.
  911.  
  912. * Menu:
  913.  
  914. * md5::
  915. * mpz::
  916. * rotor::
  917.  
  918. 
  919. File: python-lib.info,  Node: md5,  Next: mpz,  Prev: CRYPTOGRAPHIC EXTENSIONS,  Up: CRYPTOGRAPHIC EXTENSIONS
  920.  
  921. Built-in module `md5'
  922. =====================
  923.  
  924. This module implements the interface to RSA's MD5 message digest
  925. algorithm (see also the file `md5.doc'). It's use is very
  926. straightforward: use the function `md5' to create an "md5"-object. You
  927. can now "feed" this object with arbitrary strings.
  928.  
  929. At any time you can ask the "final" digest of the object. Internally, a
  930. temorary copy of the object is made and the digest is computed and
  931. returned. Because of the copy, the digest operation is not desctructive
  932. for the object. Before a more exact description of the use, a small
  933. example: to obtain the digest of the string `'abc'', use ...
  934.      >>> from md5 import md5
  935.      >>> m = md5()
  936.      >>> m.update('abc')
  937.      >>> m.digest()
  938.      '\220\001P\230<\322O\260\326\226?}(\341\177r'
  939. More condensed:
  940.  
  941.      >>> md5('abc').digest()
  942.      '\220\001P\230<\322O\260\326\226?}(\341\177r'
  943.  
  944.  - function of module md5: md5 (ARG)
  945.      Create a new md5-object. ARG is optional: if present, an initial
  946.      `update' method is called with ARG as argument.
  947.  
  948. An md5-object has the following methods:
  949.  
  950.  - Method on md5: update (ARG)
  951.      Update this md5-object with the string ARG.
  952.  
  953.  - Method on md5: digest ()
  954.      Return the "digest" of this md5-object. Internally, a copy is made
  955.      and the C-function `MD5Final' is called. Finally the digest is
  956.      returned.
  957.  
  958.  - Method on md5: copy ()
  959.      Return a separate copy of this md5-object.  An `update' to this
  960.      copy won't affect the original object.
  961.  
  962. 
  963. File: python-lib.info,  Node: mpz,  Next: rotor,  Prev: md5,  Up: CRYPTOGRAPHIC EXTENSIONS
  964.  
  965. Built-in module `mpz'
  966. =====================
  967.  
  968. This module implements the interface to part of the GNU MP library.
  969. This library contains arbitrary precision integer and rational number
  970. arithmetic routines. Only the interfaces to the *integer* (`mpz_...')
  971. routines are provided. If not stated otherwise, the description in the
  972. GNU MP documentation can be applied.
  973.  
  974. In general, "mpz"-numbers can be used just like other standard Python
  975. numbers, e.g. you can use the built-in operators like `+', `*', etc.,
  976. as well as the standard built-in functions like `abs', `int', ...,
  977. `divmod', `pow'.  *Please note:* the bitwise-xor operation has been
  978. implemented as a bunch of ands, inverts and ors, because the library
  979. lacks an `mpz_xor' function, and I didn't need one.
  980.  
  981. You create an mpz-number, by calling the function called `mpz' (see
  982. below for an excact description). An mpz-number is printed like this:
  983. `mpz(VALUE)'.
  984.  
  985.  - function of module mpz: mpz (VALUE)
  986.      Create a new mpz-number. VALUE can be an integer, a long, another
  987.      mpz-number, or even a string. If it is a string, it is interpreted
  988.      as an array of radix-256 digits, least significant digit first,
  989.      resulting in a positive number. See also the `binary' method,
  990.      described below.
  991.  
  992. A number of *extra* functions are defined in this module. Non
  993. mpz-arguments are converted to mpz-values first, and the functions
  994. return mpz-numbers.
  995.  
  996.  - function of module mpz: powm (BASE, EXPONENT, MODULUS)
  997.      Return `pow(BASE, EXPONENT) % MODULUS'. If `EXPONENT == 0', return
  998.      `mpz(1)'. In contrast to the C-library function, this version can
  999.      handle negative exponents.
  1000.  
  1001.  - function of module mpz: gcd (OP1, OP2)
  1002.      Return the greatest common divisor of OP1 and OP2.
  1003.  
  1004.  - function of module mpz: gcdext (A, B)
  1005.      Return a tuple `(G, S, T)', such that `A*S + B*T == G == gcd(A,
  1006.      B)'.
  1007.  
  1008.  - function of module mpz: sqrt (OP)
  1009.      Return the square root of OP. The result is rounded towards zero.
  1010.  
  1011.  - function of module mpz: sqrtrem (OP)
  1012.      Return a tuple `(ROOT, REMAINDER)', such that `ROOT*ROOT +
  1013.      REMAINDER == OP'.
  1014.  
  1015.  - function of module mpz: divm (NUMERATOR, DENOMINATOR, MODULUS)
  1016.      Returns a number Q. such that `Q * DENOMINATOR % MODULUS ==
  1017.      NUMERATOR'.  One could also implement this function in python,
  1018.      using `gcdext'.
  1019.  
  1020. An mpz-number has one method:
  1021.  
  1022.  - Method on mpz: binary ()
  1023.      Convert this mpz-number to a binary string, where the number has
  1024.      been stored as an array of radix-256 digits, least significant
  1025.      digit first.
  1026.  
  1027.      The mpz-number must have a value greater than- or equal to zero,
  1028.      otherwise a `ValueError'-exception will be raised.
  1029.  
  1030. 
  1031. File: python-lib.info,  Node: rotor,  Prev: mpz,  Up: CRYPTOGRAPHIC EXTENSIONS
  1032.  
  1033. Built-in module `rotor'
  1034. =======================
  1035.  
  1036. This module implements a rotor-based encryption algorithm, contributed
  1037. by Lance Ellinghouse.  Currently no further documentation is available
  1038. -- you are kindly advised to read the source...
  1039.  
  1040. 
  1041. File: python-lib.info,  Node: STDWIN ONLY,  Next: SGI IRIX ONLY,  Prev: CRYPTOGRAPHIC EXTENSIONS,  Up: Top
  1042.  
  1043. STDWIN ONLY
  1044. ***********
  1045.  
  1046. * Menu:
  1047.  
  1048. * stdwin::
  1049. * stdwinevents::
  1050. * rect::
  1051.  
  1052. 
  1053. File: python-lib.info,  Node: stdwin,  Next: stdwinevents,  Prev: STDWIN ONLY,  Up: STDWIN ONLY
  1054.  
  1055. Built-in Module `stdwin'
  1056. ========================
  1057.  
  1058. This module defines several new object types and functions that provide
  1059. access to the functionality of the Standard Window System Interface,
  1060. STDWIN [CWI report CR-R8817].  It is available on systems to which
  1061. STDWIN has been ported (which is most systems).  It is only available
  1062. if the `DISPLAY' environment variable is set or an explicit `-display
  1063. DISPLAYNAME' argument is passed to the interpreter.
  1064.  
  1065. Functions have names that usually resemble their C STDWIN counterparts
  1066. with the initial `w' dropped.  Points are represented by pairs of
  1067. integers; rectangles by pairs of points.  For a complete description of
  1068. STDWIN please refer to the documentation of STDWIN for C programmers
  1069. (aforementioned CWI report).
  1070.  
  1071. * Menu:
  1072.  
  1073. * Functions Defined in Module stdwin::
  1074. * Window Object::
  1075. * Drawing Object::
  1076. * Menu Object::
  1077. * Bitmap Object::
  1078. * Text-edit Object::
  1079. * Stdwin Example::
  1080.  
  1081.